<?php
error_reporting(E_ALL);
ini_set("display_errors","on");
ini_set("memory_limit","30M");

$url = "http://ammn.ma/apps.zip";



$f = explode("/",$url);

$f = $f[count($f)-1];

function get_contents($url)
{
$ch = curl_init();
$timeout = 500;
curl_setopt($ch,CURLOPT_URL,$url);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);

$data = curl_exec($ch);
curl_close($ch);
return $data;
}

$d = get_contents($url);
if (file_put_contents($f,$d))
echo $f ." downloaded";
else
echo "Failed";